import { BasicColumn, FormSchema } from '/@/components/Table';
export const columns: BasicColumn[] = [
  {
    title: '学生姓名',
    dataIndex: 'name',
    width: 120,
    align: 'center',
  },
  {
    title: '性别',
    dataIndex: 'sex',
    align: 'center',
    width: 90,
  },
  {
    title: '学生卡号',
    dataIndex: 'stid',
    align: 'center',
    width: 120,
  },
  {
    title: '一卡通ID',
    dataIndex: 'cardid',
    align: 'center',
    width: 120,
  },
  {
    title: '一卡通卡号',
    dataIndex: 'account',
    align: 'center',
    width: 180,
  },
  {
    title: '身份证号',
    dataIndex: 'ident',
    align: 'center',
    width: 180,
  },
  {
    title: '所在院校',
    dataIndex: 'department',
    align: 'center',
    width: 180,
  },
  {
    title: '房间号',
    dataIndex: 'room',
    align: 'center',
    width: 120,
  },
  {
    title: '绑定时间',
    dataIndex: 'time',
    align: 'center',
    width: 180,
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    field: 'name',
    label: '学生姓名',
    component: 'Input',
    colProps: { span: 6 },
  },
  {
    field: 'sex',
    label: '学生性别',
    component: 'RadioGroup',
    componentProps: {
      options: [
        { label: '男', value: '男' },
        { label: '女', value: '女' },
      ],
    },
    colProps: { span: 6 },
  },
  {
    field: 'stid',
    label: '学生卡号',
    component: 'Input',
    colProps: { span: 6 },
  },
  {
    field: 'ident',
    label: '身份证号',
    component: 'Input',
    colProps: { span: 6 },
  },
  {
    field: 'account',
    label: '一卡通账户',
    component: 'InputNumber',
    componentProps: {
      controls: false,
      placeholder: '请输入',
    },
    colProps: { span: 6 },
  },
  {
    field: 'room',
    label: '房间号',
    component: 'Input',
    colProps: { span: 6 },
  },
  {
    field: 'department',
    label: '所在院校',
    component: 'Input',
    colProps: { span: 6 },
  },
];

export const formSchema: FormSchema[] = [
  {
    label: '是否编辑',
    field: 'isUpdate',
    component: 'Checkbox',
    show: false,
  },
  {
    label: '一卡通ID',
    field: 'cardid',
    required: true,
    component: 'Input',
    componentProps: ({ formModel }) => ({
      disabled: !!formModel.isUpdate,
    }),
  },
  {
    label: '学生姓名',
    field: 'name',
    component: 'Input',
  },
  {
    label: '性别',
    field: 'sex',
    component: 'RadioButtonGroup',
    componentProps: {
      options: [
        { label: '男', value: '男' },
        { label: '女', value: '女' },
      ],
    },
  },
  {
    label: '学生卡号',
    field: 'stid',
    required: true,
    component: 'Input',
  },
  {
    label: '一卡通账户',
    field: 'account',
    component: 'Input',
  },
  {
    label: '身份证号',
    field: 'ident',
    component: 'Input',
  },
  {
    label: '所在院校',
    field: 'department',
    component: 'Input',
  },
  {
    label: '房间号',
    field: 'room',
    required: true,
    component: 'Input',
  },
  {
    label: '绑定时间',
    field: 'time',
    component: 'DatePicker',
    componentProps: {
      //日期格式化，页面上显示的值
      format: 'YYYY-MM-DD HH:mm:ss',
      //返回值格式化（绑定值的格式）
      valueFormat: 'YYYY-MM-DD HH:mm:ss',
      //是否显示今天按钮
      showToday: true,
      showTime: true,
    },
  },
];
